
#ifndef __IPC_EVENT_API_H__
#define __IPC_EVENT_API_H__

// @brief ipc event callback function prototype definition
typedef int (* IPC_EVT_API_CALLBACK)(int , void * , int);

#ifdef __cplusplus
extern "C" {
#endif
/**
 *********************************************************************************
 *
 * @brief initialize the ipc event service
 *
 * @param   Purpose:
 *          set up the TCP connection to the ipc event daemon server
 *			and register the event callback function
 *
 * @param   Usage notes:
 *          -
 *
 *********************************************************************************
 */
int initialize_ipc_evt(IPC_EVT_API_CALLBACK funcPtr, const char *log_tag);

/**
 *********************************************************************************
 *
 * @brief finalize the ipc event service
 *
 * @param   Purpose:
 *          close the TCP connection to the ipc event daemon server
 *
 * @param   Usage notes:
 *          -
 *
 *********************************************************************************
 */
int finalize_ipc_evt(void);

/**
 *********************************************************************************
 *
 * @brief register the interested event 
 *
 * @param   Purpose:
 *          subscrib the event which is intereted by application, when the event 
 *			occur, the registered application will be notified.
 *
 * @param   Usage notes:
 *          -
 *
 *********************************************************************************
 */
int subscribe_ipc_evt(int type);

/**
 *********************************************************************************
 *
 * @brief un-register the interested event 
 *
 * @param   Purpose:
 *          un-subscrib the event which is not intereted by application, when the event 
 *			occur, the un-registered application will not be notified.
 *
 * @param   Usage notes:
 *          -
 *
 *********************************************************************************
 */
int unsubscribe_ipc_evt(int type);

/**
 *********************************************************************************
 *
 * @brief publish the event
 *
 * @param   Purpose:
 *          publish an event, broodcast or p2p communication mode.
 *
 * @param   Usage notes:
 *          -
 *
 *********************************************************************************
 */
int publish_ipc_evt(int type , void * data , int length);


/**
 *********************************************************************************
 *
 * @brief publish the event
 *
 * @param   Purpose:
 *          run the event loop for handling the incoming message from the daemon
 *			server.
 *
 * @param   Usage notes:
 *          -
 *
 *********************************************************************************
 */
void run_ipc_evt_loop(void);

/**
 *********************************************************************************
 *
 * @brief get the ipc file descriptor
 *
 * @param   Purpose:
 *          publish an event, broodcast or p2p communication mode.
 *
 * @param   Usage notes:
 *          -
 *
 *********************************************************************************
 */
int get_ipc_evt_handle(void);

/**
 *********************************************************************************
 *
 * @brief handle ipc_evt_message
 *
 * @param   Purpose:
 *          publish an event, broodcast or p2p communication mode.
 *
 * @param   Usage notes:
 *          -
 *
 *********************************************************************************
 */
int handle_ipc_evt_message(void);

#ifdef __cplusplus
}
#endif

#endif

